using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using FarseerGames.FarseerPhysics.Dynamics;
using FarseerGames.FarseerPhysics.Collisions;
using StupidSpaceThing.MenuSystem;

namespace StupidSpaceThing
{
	internal class PlayerEntity : FlyingEntity
	{
		private static Model _model;
		public static void InitModel(Model model) {
			_model = model;
		}

		public PlayerEntity(Vector3 position)
			: base(_model, position, Quaternion.Identity, 0.0007f) {
			armor = 15;
			float radius = 2.0f;
			colObject = new ColCircle(this, 1, radius);			
			colObject.Geom.RestitutionCoefficient = .7f;
			colObject.Geom.FrictionCoefficient = 0.2f;
			colObject.Body.LinearDragCoefficient = 3.5f;
		}

		public override void Update(RealGameTime gameTime) {
			Heal(0.05f);
			Rotate(0, 0.1f, 0);
			base.Update(gameTime);
		}

		public override void DrawLifeQuad(Camera camera) {
			if( !((Player)FactionEntity).Died ) {
				base.DrawLifeQuad(camera);
			}
		}

		public override void ApplyDamage(float damage, FactionEntity attacker) {
			TopMenu.Vibration[0] += (damage / Armor) / 10.0f;
			base.ApplyDamage(damage, attacker);
		}
	}
}
